package com.sanjiayi.service.impl;

import com.sanjiayi.dto.NearbyUserDTO;
import com.sanjiayi.mapper.UserMapper;
import com.sanjiayi.pojo.User;
import com.sanjiayi.service.NearbyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Slf4j
@Service
public class NearbyServiceImpl implements NearbyService {

    @Autowired
    private UserMapper userMapper;

    @Override
    @Transactional
    public void updateLocation(NearbyUserDTO nearbyUserDTO) {
        log.info("更新用户位置信息: {}", nearbyUserDTO);
        userMapper.updateLocation(nearbyUserDTO);
    }

    @Override
    public List<User> findNearbyUsers(NearbyUserDTO nearbyUserDTO) {
        log.info("查询附近用户: {}", nearbyUserDTO);
        return userMapper.findNearbyUsers(nearbyUserDTO);
    }
} 